package com.example.myapplication.ui.notifications;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import android.app.Fragment;

import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;

import com.example.myapplication.LoginActivity;
import com.example.myapplication.R;
import com.example.myapplication.RegisterActivity;
import com.example.myapplication.dao.ConfirmDao;
import com.example.myapplication.entity.User;
import com.example.myapplication.ui.home.HomeFragment;
import com.google.android.material.navigation.NavigationView;

import java.util.Objects;

public class NotificationsFragment extends Fragment {

    @Override
    public void onResume() {
        if (ConfirmDao.islogin) {
            getFragmentManager().beginTransaction().replace(R.id.host_fragment, new LoginedFragment()).commit();

        }
        super.onResume();
    }

    public View onCreateView(@NonNull LayoutInflater inflater,
                             ViewGroup container, Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.fragment_notifications, container, false);
        Button btnin = view.findViewById(R.id.btn_in);
        btnin.setOnClickListener(v -> {
            Intent myintent = new Intent(getActivity().getApplicationContext(), LoginActivity.class);

            startActivity(myintent ); //启动目标Activity
        });

        Button btnre = view.findViewById(R.id.btn_re);
        btnre.setOnClickListener(v -> {
            Intent myintent = new Intent(getActivity().getApplicationContext(), RegisterActivity.class);

            startActivity(myintent ); //启动目标Activity
        });
        return view;
    }

}


